package com.ruyuan.ingestion.parser;

import com.ruyuan.ingestion.common.Parsable;

public abstract class EventParser<T> implements Parsable<T> {

    //event_id,user_id,start_time,city,state,zip,country,lat,lng
    @Override
    public Boolean isHeader(String[] fields) {
        return (isValid(fields)
                && fields[0].equals("event_id")
                && fields[1].equals("user_id")
                && fields[2].equals("start_time")
                && fields[3].equals("city")
                && fields[4].equals("state")
                && fields[5].equals("zip")
                && fields[6].equals("country")
                && fields[7].equals("lat")
                && fields[8].equals("lng")
        );
    }

    @Override
    public Boolean isValid(String[] fields) {
        return (fields.length > 8 && !isEmpty(fields,new int[]{0}));
    }
}
